@include('home.head')
<link rel="stylesheet" type="text/css" href="css/carstyle.css" media="all">
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<div class="colorarea01" >
<!-- 	<div class="search clearfix">
		<div class="searchL">
			<ul class="menulist">
				<li><a href="addcar" class="list">求购二手车</a></li>
			</ul>
		</div>
	</div> -->
	<form name="form1" class="carform" enctype="multipart/form-data" method="post" action="{{url('home/addcar')}}" onsubmit="return chksubmit();">
	{!!csrf_field()!!}
		<table class="maintable" cellpadding="0" cellspacing="0"  id="tb" width="100%">
			<tbody style="height: 600px;">
                <tr>
				<th>品牌型号：</th>
				<td colspan="3">
				<em>
					<select name="p_brand" id="brand" datatype="n" nullmsg="请选择品牌！">
						<option value="">请选择品牌</option>
						@foreach ($cars as $u)
						<option value="{{$u->b_id}}" onclick="xi()">
						<span>{{$u->mark}}</span>
						{{$u->b_name}}</option>
						@endforeach	
					</select>
					</em>&nbsp;&nbsp;
					<span id="span"></span>
					<script>
				function xi(){
                var b_id = $('select[name=p_brand] option:selected').val();
                $.ajax({
                url:"{{'getAttributeByType'}}",
                data:{'b_id':b_id},
                dataType:'json',
                type:'get',
                success:function(msg){
                     var s = "";
                        s += "<select name ='p_subbrand' id='subbrand'>";
                        s += "<option value='0'>--请选择--</option>";
                        $.each(msg,function(kk,vv){
                           s+="<option value='"+vv.b_id+"' onclick='son()'>"+vv.b_name+"</option>";
                        });
                        s += "</select>";
                    $('#subbrand').remove();
                    $('em').append(s);
                }
                
                });
            }
					</script>

				<script>
					function son(){
					var b_id = $('select[name=p_subbrand] option:selected').val();
						$.ajax({
						url:"{{'songetAttributeByType'}}",
						data:{'b_id':b_id},
						dataType:'json',
						type:'get',
					success:function(msg){
					var s = "";
						s += "<select name ='p_subsubbrand' id='subsubbrand'>";
						s += "<option value='0'>--请选择--</option>";
						$.each(msg,function(kk,vv){
						s+="<option value='"+vv.b_id+"' >"+vv.b_name+"</option>";
						});
						s += "</select>";
						$('#subsubbrand').remove();
						$('#span').append(s);
						}
						});
						}
				</script>

					<select class="subbrand" id="subbrand" name="p_subbrand" datatype="n" nullmsg="请选择车系！">
						<option value="">请选择车系</option>
						                    
					</select>&nbsp;&nbsp;<select class="subbrand" id="subsubbrand" name="p_subsubbrand" datatype="n" nullmsg="请选择款式！">
					<option value="">请选择款式</option>
							
					</select>

					<span class="Validform_checktip"></span></td>

			</tr>
			<tr>
				<th>车体颜色：</th>
				<td width="180"><select name="p_color">
						<option value="">请选择颜色</option>
						<option value="白色">白色</option>
						<option value="绿色">绿色</option>
						<option value="蓝色">蓝色</option>
						<option value="红色">红色</option>
						<option value="黄色">黄色</option>
						<option value="银灰">银灰</option>
						<option value="黑色">黑色</option>
						<option value="橙色">橙色</option>
					</select></td>
				<th width="50">排量：</th>
				<td><select name="p_gas">
						<option value="">请选择排量</option>
						<option value="1.0">1.0</option>
						<option value="1.2">1.2</option>
						<option value="1.4">1.4</option>
						<option value="1.5">1.5</option>
						<option value="1.6">1.6</option>
						<option value="1.8">1.8</option>
						<option value="2.0">2.0</option>
						<option value="2.4">2.4</option>
						<option value="2.7">2.7</option>
						<option value="3.0">3.0</option>
						<option value="3.0以上">3.0以上</option>
					</select></td>
			</tr>

			<tr>
				<th>变速箱：</th>
				<td><select name="p_transmission">
						<option value="">请选择变速箱</option>
						<option value="手动">手动</option>
						<option value="自动">自动</option>
						<option value="手自一体">手自一体</option>
						</select></td>

										<th>车型选择：</th>
				<td><select name="p_model">
					<option value="0">请选择</option>
					@foreach ($model as $u)
					<option value="{{$u->sid}}">{{$u->s_name}}</option>
					@endforeach
					</select></td>


			</tr>

			<tr>

			<th>期望价格：</th>
				<td><input name="p_price" size="5" value="" datatype="s" nullmsg="请填写价格！" type="text">
					<span class="gray">(万元)</span><span class="Validform_checktip"></span></td>
				<th>行驶里程：</th>
				<td><input name="p_kilometre" id="p_kilometre" size="5" value="" type="text">
					<span class="gray">(万公里)</span>
				</td>

			</tr>
                          
           			
			<tr>
				<th>补充描述：</th>
				<td colspan="5"><textarea name="p_details" rows="2" cols="90" class="textarea01"></textarea></td>
			</tr>
			<tr>
				<th>车主姓名：</th>
				<td colspan="5"><input name="p_username" value="" type="text"></td>
			</tr>
			<tr>
				<th>联系电话：</th>
				<td colspan="5"><input name="p_tel" value="" type="text"></td>
			</tr>
				<th></th>
				<td colspan="5" ><div class="buttons">
						<input value="确定发布" class="submit" type="submit" style="height: 80px; ">
						<input name="a" value="add" type="hidden">
						<input name="id" value="" type="hidden">
						<input name="page" value="1" type="hidden">
				</div>
				</td>
			</tr>
		</tbody></table>
@include('home.foot ')
